package com.wwtech.epp.ui.activity.work;

import android.os.Bundle;
import android.widget.TextView;

import com.wwtech.epp.R;
import com.wwtech.epp.application.AppConfig;
import com.wwtech.epp.base.BaseActivity;
import com.wwtech.epp.entity.Report;
import com.wwtech.epp.ui.activity.work.component.DaggerReportDetailComponent;
import com.wwtech.epp.ui.activity.work.contract.ReportDetailContract;
import com.wwtech.epp.ui.activity.work.module.ReportDetailModule;
import com.wwtech.epp.ui.activity.work.presenter.ReportDetailPresenter;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: $description
 * @date 2017/10/19 23:02:48
 */

public class ReportDetailActivity extends BaseActivity implements ReportDetailContract.View {

    @Inject
    ReportDetailPresenter mPresenter;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.project)
    TextView project;
    @BindView(R.id.nick)
    TextView nick;
    @BindView(R.id.content)
    TextView content;
    @BindView(R.id.xietiao)
    TextView xietiao;
    @BindView(R.id.beizhu)
    TextView beizhu;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        setContentView(R.layout.activity_report_detail);
        ButterKnife.bind(this);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    protected void initData() {
        setTitle("汇报详情");
        Report report = getIntent().getParcelableExtra("dataBean");
        project.setText(getIntent().getStringExtra("projectName"));
        tvTitle.setText(report.getTitle());
        nick.setText(report.getName());
        content.setText(report.getContent());
        xietiao.setText(report.getCoordinateJob());
        beizhu.setText(report.getExtrainfo());

    }

    @Override
    protected void setupActivityComponent() {
        DaggerReportDetailComponent
                .builder()
                .appComponent(((AppConfig) getApplication()).getApplicationComponent())
                .reportDetailModule(new ReportDetailModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void setPresenter(ReportDetailContract.ReportDetailContractPresenter presenter) {
        mPresenter = (ReportDetailPresenter) presenter;
    }

    @Override
    public void showProgressDialog() {
        progressDialog.show();
    }

    @Override
    public void closeProgressDialog() {
        progressDialog.hide();
    }

}